﻿using System;
using System.Collections.Generic;
using System.Data.Entity.ModelConfiguration;
using System.Linq;
using System.Text;

namespace MP.Data.Models.Models.Mapping
{
    public class FoodMap : EntityTypeConfiguration<Food>
    {
        public FoodMap()
        {
            this.HasKey(t => t.Id);

            this.Property(t => t.Name)
                .IsRequired()
                .HasMaxLength(50);
            
            this.Property(t => t.MeasureAmountId)
                .IsRequired();
            
            this.Property(t => t.Price)
                .IsRequired();

            // Table & Column Mappings
            this.ToTable("Food", "Prices");
            this.Property(t => t.Id).HasColumnName("Id");
            this.Property(t => t.Name).HasColumnName("Name");
            this.Property(t => t.MeasureAmountId).HasColumnName("MeasureAmountId");
            this.Property(t => t.Price).HasColumnName("Price");
        }
    }
}
